const $=(function(){
    const getParams=(data)=>{
        var str="";
        for(var key in data){
            str+=key+"="+data[key]+"&";
        }
        return str;
    }

    const jsonp=(settings={})=>{
        return new Promise(function(resolve,reject){
            let fnName="jQuery_"+parseInt(Math.random()*10000);
            window[fnName]=resolve;

            let newUrl=settings.url+"?"+getParams(settings.data)+settings.jsonp+"="+fnName;
            let oScript=document.createElement("script");
            oScript.setAttribute("src",newUrl);

            document.body.appendChild(oScript);
            oScript.onload=function(){
                this.remove();
            }
        })
    }
    return {
        jsonp
    }
})()